﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Kooboo.CMS.Content.Persistence;
[assembly: System.Web.PreApplicationStartMethod(typeof(Kooboo.CMS.SchemaSyncWrapper.AssemblyInitializer), "Initialize")]
namespace Kooboo.CMS.SchemaSyncWrapper
{
    public static class AssemblyInitializer
    {
        public static void Initialize()
        {
            ApplicationInitialization.RegisterInitializerMethod(delegate()
            {
                var schemaProvider = Kooboo.CMS.Content.Persistence.Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>();
                var siteProvider = Kooboo.CMS.Sites.Persistence.Providers.SiteProvider;
                Kooboo.CMS.Content.Persistence.Providers.DefaultProviderFactory.RegisterProvider<ISchemaProvider>(new SchemaProviderWrapper(schemaProvider, siteProvider));

                Kooboo.CMS.Content.Services.ServiceFactory.SchemaManager = new SchemaManagerWrapper(siteProvider, Kooboo.CMS.Content.Services.ServiceFactory.SchemaManager);

            }, 100);
        }
    }
}
